<%--<%@ page import="com.shop.service.CourseService" %>--%>
<%--<%@ page import="com.shop.model.Course" %>--%>
<%--<%@ page import="java.util.List" %>&lt;%&ndash;--%>
<%--  Created by IntelliJ IDEA.--%>
<%--  User: Administrator--%>
<%--  Date: 2025/4/29--%>
<%--  Time: 上午9:03--%>
<%--  To change this template use File | Settings | File Templates.--%>
<%--&ndash;%&gt;--%>
<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%>
<%--<html>--%>
<%--<head>--%>
<%--    <title>课程详情</title>--%>
<%--</head>--%>
<%--<body>--%>
<%--<h2>课程详情</h2>--%>
<%--<%--%>
<%--    String studentId = request.getParameter("studentId");--%>
<%--    CourseService courseService = new CourseService();--%>
<%--    String courseId =request.getParameter("courseId");--%>
<%--    List<Course> courses = courseService.searchCourse(Integer.parseInt(courseId),null);--%>
<%--%>--%>
<%--<%--%>
<%--    for (Course course : courses) {--%>
<%--%>--%>
<%--<h3 style="color: red">学生打九折，学生VIP打六折</h3>--%>
<%--<p>课程ID: <%=course.getCourseId()%></p>--%>
<%--<h3>课程名称: <%=course.getCourseName()%></h3>--%>
<%--<p>价格: <%=course.getPrice()%></p>--%>
<%--<p>所属类型: <%=course.getType()%></p>--%>
<%--<p>教课老师: <%=course.getTeacher()%></p>--%>
<%--<p>上课时间: <%=course.getStartDate()%></p>--%>
<%--<p>结课时间: <%=course.getEndDate()%></p>--%>
<%--<p>课时: <%=course.getTime()%></p>--%>
<%--<p>课程余额: <%=course.getCapacity()%></p>--%>
<%--<%--%>
<%--    }--%>
<%--%>--%>
<%--<form action="cart" method="post">--%>
<%--    <input type="hidden" name="studentId" value="<%=studentId%>">--%>
<%--    <input type="hidden" name="courseId" value="<%=courseId %>">--%>
<%--    <button type="submit" formaction="/buy" name="source" value="page1">购买</button>--%>
<%--    <input type="submit" value="加入购物车">--%>
<%--</form>--%>
<%--</body>--%>
<%--</html>--%>

<%@ page import="com.shop.service.CourseService" %>
<%@ page import="com.shop.model.Course" %>
<%@ page import="java.util.List" %>
<%@ page import="com.shop.service.ICourseService" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>课程详情</title>
    <style>
        :root {
            --primary-color: #4361ee;
            --secondary-color: #3a0ca3;
            --accent-color: #4895ef;
            --light-color: #f8f9fa;
            --dark-color: #212529;
            --success-color: #4cc9f0;
            --danger-color: #f72585;
            --discount-color: #ff6b6b;
            --border-radius: 12px;
            --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
            --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }

        body {
            background-color: #f5f7ff;
            color: var(--dark-color);
            line-height: 1.6;
            padding: 0;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        .container {
            max-width: 800px;
            margin: 40px auto;
            background: white;
            border-radius: var(--border-radius);
            box-shadow: var(--box-shadow);
            overflow: hidden;
            position: relative;
        }

        .container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 6px;
            background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
        }

        .course-header {
            padding: 30px 40px 20px;
            border-bottom: 1px solid #eee;
        }

        .course-header h2 {
            color: var(--primary-color);
            font-size: 28px;
            margin-bottom: 10px;
            position: relative;
            padding-bottom: 10px;
        }

        .course-header h2::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 60px;
            height: 3px;
            background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
            border-radius: 3px;
        }

        .discount-banner {
            background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 159, 67, 0.1) 100%);
            border-left: 4px solid var(--discount-color);
            padding: 12px 20px;
            margin: 20px 0;
            border-radius: 4px;
            font-weight: 500;
            color: var(--discount-color);
        }

        .course-content {
            padding: 30px 40px;
        }

        .course-info {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 20px;
            margin-bottom: 30px;
        }

        .info-item {
            margin-bottom: 15px;
        }

        .info-label {
            font-size: 14px;
            color: #666;
            margin-bottom: 5px;
        }

        .info-value {
            font-size: 16px;
            font-weight: 500;
        }

        .price-value {
            font-size: 24px;
            font-weight: 700;
            color: var(--primary-color);
        }

        .type-tag {
            display: inline-block;
            padding: 4px 12px;
            background: rgba(67, 97, 238, 0.1);
            color: var(--primary-color);
            border-radius: 20px;
            font-size: 14px;
            font-weight: 500;
        }

        .action-buttons {
            display: flex;
            gap: 20px;
            margin-top: 40px;
            padding-top: 30px;
            border-top: 1px solid #eee;
        }

        .btn {
            flex: 1;
            padding: 16px;
            border-radius: var(--border-radius);
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: var(--transition);
            text-align: center;
            text-decoration: none;
            display: inline-block;
        }

        .btn-primary {
            background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
            color: white;
            border: none;
            box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
        }

        .btn-secondary {
            background: white;
            color: var(--primary-color);
            border: 1px solid var(--primary-color);
        }

        .btn-secondary:hover {
            background: rgba(67, 97, 238, 0.05);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(67, 97, 238, 0.1);
        }

        @media (max-width: 768px) {
            .container {
                margin: 20px;
            }

            .course-header, .course-content {
                padding: 20px;
            }

            .course-info {
                grid-template-columns: 1fr;
            }

            .action-buttons {
                flex-direction: column;
                gap: 12px;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <div class="course-header">
        <h2>课程详情</h2>
    </div>

    <div class="course-content">
        <%
            String studentId = request.getParameter("studentId");
            ICourseService icourseService = new CourseService();
            String courseId = request.getParameter("courseId");
            List<Course> courses = icourseService.searchCourse(Integer.parseInt(courseId), null);
        %>

        <% for (Course course : courses) { %>
        <div class="discount-banner">
            学生打九七折，学生VIP打六折
        </div>

        <div class="course-info">
            <div class="info-item">
                <div class="info-label">课程ID</div>
                <div class="info-value"><%=course.getCourseId()%></div>
            </div>

            <div class="info-item">
                <div class="info-label">课程名称</div>
                <div class="info-value" style="font-size: 20px; font-weight: 600;"><%=course.getCourseName()%></div>
            </div>

            <div class="info-item">
                <div class="info-label">价格</div>
                <div class="price-value">¥<%=course.getPrice()%></div>
            </div>

            <div class="info-item">
                <div class="info-label">课程类型</div>
                <div class="info-value"><span class="type-tag"><%=course.getType()%></span></div>
            </div>

            <div class="info-item">
                <div class="info-label">授课教师</div>
                <div class="info-value"><%=course.getTeacher()%></div>
            </div>

            <div class="info-item">
                <div class="info-label">开课时间</div>
                <div class="info-value"><%=course.getStartDate()%></div>
            </div>

            <div class="info-item">
                <div class="info-label">结课时间</div>
                <div class="info-value"><%=course.getEndDate()%></div>
            </div>

            <div class="info-item">
                <div class="info-label">课时</div>
                <div class="info-value"><%=course.getTime()%></div>
            </div>

            <div class="info-item">
                <div class="info-label">剩余名额</div>
                <div class="info-value"><%=course.getCapacity()%></div>
            </div>
        </div>

        <form action="cart" method="post" class="action-buttons">
            <input type="hidden" name="studentId" value="<%=studentId%>">
            <input type="hidden" name="courseId" value="<%=courseId %>">
            <button type="submit" formaction="/buy" name="source" value="page1" class="btn btn-primary">立即购买</button>
            <button type="submit" class="btn btn-secondary">加入购物车</button>
        </form>
        <% } %>
    </div>
</div>
</body>
</html>